<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            position: relative;
        }

        #ball {
            height: 150px;
            width: 150px;
            background-image: radial-gradient(farthest-corner at 10% 25%, rgb(187, 226, 248), rgb(165, 225, 243), rgb(50, 165, 194));
            border-radius: 50%;
            position: absolute;
            left: 0;
            top: 0;
        }
    </style>
</head>

<body>
    <div id="ball"></div>
    <script>
        let ball = document.getElementById('ball');
        let w = innerWidth - ball.offsetWidth;
        let h = innerHeight - ball.offsetHeight;

        let x = 0;
        let y = 0;
        let i = 5;
        let j = 5;
        setInterval(function () {
            x += i;
            if (x > w || x < 0) {
                i = -i;
            }
            y += j;
            if (y > h || y < 0) {
                j = -j;
            }
            ball.style.cssText = `left:${x}px;top:${y}px`
        }, 10)
    </script>
</body>

</html>